home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2007 January, February, March & April
/
Chip-Cover-CD-2007-02.iso
/
Pakiet bezpieczenstwa
/
mini Pentoo LiveCD 2006.1
/
mpentoo-2006.1.iso
/
livecd.squashfs
/
usr
/
lib
/
gkismet
/
GpsBox.pm
< prev
next >
Wrap
Text File
|
2005-10-20
|
2KB
|
130 lines
#!/usr/bin/perl -w
#
# $Id: GpsBox.pm,v 1.5 2003/08/04 05:06:12 solovam Exp $
#
# This file is a part of gkismet
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
#
# GpsBox class
#
package GpsBox;
use Gtk;
use Misc;
use InfoBox;
use strict;
@GpsBox::ISA = qw(InfoBox);
my @labels = qw(Latitude Longitude Altitude Speed Fix);
#
# Return list of labels
#
sub getLabels
{
my $self = shift;
return(@labels);
}
#
# Get value by label
#
sub getValue
{
my $self = shift;
my $label = shift;
if($label eq 'Latitude')
{
return sprintf '%.3f', $self->{'connection'}->getGps()->{'lat'};
}
elsif($label eq 'Longitude')
{
return sprintf '%.3f', $self->{'connection'}->getGps()->{'lon'};
}
elsif($label eq 'Altitude')
{
if($self->{'gKismetApplication'}->{'preferences'}->getPref('units') eq 'imperial')
{
return sprintf '%.3fft', $self->{'connection'}->getGps()->{'alt'};
}
else
{
return sprintf '%.3fm', $self->{'connection'}->getGps()->{'alt'} * $footFactor;
}
}
elsif($label eq 'Speed')
{
if($self->{'gKismetApplication'}->{'preferences'}->getPref('units') eq 'imperial')
{
return sprintf '%.3fmph', $self->{'connection'}->getGps()->{'spd'};
}
else
{
return sprintf '%.3fkmh', $self->{'connection'}->getGps()->{'spd'} / ($mileFactor / 1000);
}
}
elsif($label eq 'Fix')
{
my $fix = $self->{'connection'}->getGps()->{'fix'};
if($fix == -1)
{
return 'No signal';
}
elsif($fix == 2)
{
return '2D';
}
elsif($fix == 3)
{
return '3D';
}
else
{
return 'NONE';
}
}
}
#
# Frame label
#
sub getTitle
{
return 'GPS data';
}
#
# Is ot our update?
#
sub isInterestingUpdate
{
my $self = shift;
my $data = shift;
if($data->{'changed'} eq 'gps')
{
return $true;
}
else
{
return $false;
}
}
1;